let url1 = new URL("./image/tent.png",window.location.href)
// 设置一个图标对象
var icon = {
   // 图标类型，现阶段只支持 image 类型
   type: 'image',
   // 图片 url
   image: url1,
   // 图片尺寸
   size: [64, 30],
   // 图片相对 position 的锚点，默认为 bottom-center
   anchor: 'center',
};
var textStyle = {
    fontSize: 12,
    fontWeight: 'normal',
    fillColor: '#22886f',
    strokeColor: '#fff',
    strokeWidth: 2,
    fold: true,
    padding: '2, 5',
};
var tentLabelsData = [
    { 
        name: '天津东疆艾威国际房车海滨露营地',
        position: [117.832457, 39.013278],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 10,
        fold: true,
        icon,
        text: {
            // 要展示的文字内容
            content: '东疆艾威国际房车海滨露营地',
            // 文字方向，有 icon 时为围绕文字的方向，没有 icon 时，则为相对 position 的位置
            direction: 'right',
            // 在 direction 基础上的偏移量
            offset: [-20, -5],
            // 文字样式
            style: {
                // 字体大小
                fontSize: 12,
                // 字体颜色
                fillColor: '#22886f',
                //
                strokeColor: '#fff',
                strokeWidth: 2,
                fold: true,
                padding: '2, 5',
            }
        }
    },
    {
        name: '自提点2',
        position: [117.443046, 40.235138],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 16,
        icon,
        text: {
            content: '蓟县下营镇山野运动基地露营地',
            direction: 'right',
            offset: [-20, -5],
            style: textStyle
        }
    },
    {
        name: '自提点3',
        position: [117.776983, 39.242872],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 8,
        icon,
        text: {
            content: '天津滨海茶淀木屋营地',
            direction: 'right',
            offset: [-20, -5],
            style: textStyle
        }
    },
    {
        name: '自提点4',
        position: [117.037666, 39.194142],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 23,
        icon,
        text: {
            content: '天津龙源马术俱乐部房车露营地',
            direction: 'right',
            offset: [-20, -5],
            style: textStyle
        }
    },
    {
        name: '自提点5',
        position: [117.752036, 39.874896],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 6,
        icon,
        text: {
            content: '中新天津生态城生态公园房车露营地',
            direction: 'right',
            offset: [-20, -5],
            style: textStyle
        }
    },
    {
        name: '自提点6',
        position: [117.180767, 38.891962],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 5,
        icon,
        text: {
            content: '天津光合谷凯平汽车露营地',
            direction: 'right',
            offset: [-20, -5],
            style: textStyle
        }
    },

    {
        name: '自提点9',
        position: [117.832457, 39.013278],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 4,
        icon,
        text: {
            content: '天津东疆艾威国际房车海滨露营地',
            direction: 'right',
            offset: [-20, -5],
            style: textStyle
        }
    },
    {
        name: '自提点10',
        position: [117.443046, 40.235138],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 4,
        icon,
        text: {
            content: '天津市蓟县下营镇山野运动基地露营地',
            direction: 'right',
            offset: [-20, -5],
            style: textStyle
        }
    },
    {
        name: '自提点11',
        position: [117.776983, 39.242872],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 4,
        icon,
        text: {
            content: '天津滨海茶淀木屋营地',
            direction: 'right',
            offset: [-20, -5],
            style: textStyle
        }
    },
    {
        name: '自提点12',
        position: [117.037666, 39.194142],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 4,
        icon,
        text: {
            content: '天津龙源马术俱乐部房车露营地',
            direction: 'right',
            offset: [-20, -5],
            style:textStyle
        }
    },
    {
      name:'自提点13',
      position:[117.752036,39.874896],
      zooms:[10,20],
      opacity :1,
      zIndex :4,
      icon,
      text:{
          content:'中新天津生态城生态公园房车露营地',
          direction:'right',
          offset:[-20,-5],
          style:textStyle
      }
    },
    {
      name:'自提点14',
      position:[117.180767,38.891962],
      zooms:[10,20],
      opacity :1,
      zIndex :4,
      icon,
      text:{
          content:'天津光合谷凯平汽车露营地',
          direction:'right',
          offset:[-20,-5],
          style:textStyle
      }
    },
    {
      name:'自提点15',
      position:[117.156122,39.014116],
      zooms:[10,20],
      opacity :1,
      zIndex :4,
      icon,
      text:{
          content:'天津西青郊野公园',
          direction:'right',
          offset:[-20,-5],
          style:textStyle
      }
    },
    {
      name:'自提点16',
      position:[117.038377,39.491678],
      zooms:[10,20],
      opacity :1,
      zIndex :4,
      icon,
      text:{
          content:'天津北运河休闲旅游驿站',
          direction:'right',
          offset:[-20,-5],
          style:textStyle
      }
    },
    {
       name:'自提点17',
       position:[117.032666,39.61614],
       zooms:[10,20],
       opacity :1,
       zIndex :4,
       icon,
       text:{
           content:'天津怡园温泉酒店',
           direction:'right',
           offset:[-20,-5],
           style:textStyle
       }
     },
    {
        name: '自提点19',
        position: [117.832457, 39.013278],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 4,
        icon,
        text: {
            content: '天津东疆湾景区',
            direction: 'right',
            offset: [-20, -5],
            style: textStyle
        }
    },
    {
        name: '自提点20',
        position: [116.939546, 39.095138],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 4,
        icon,
        text: {
            content: '天津市水高庄园',
            direction: 'right',
            offset: [-20, -5],
            style: textStyle
        }
    },
    {
        name: '自提点21',
        position: [117.176056, 39.281021],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 4,
        icon,
        text: {
            content: '天津市北辰郊野公园',
            direction: 'right',
            offset: [-20, -5],
            style:textStyle
        }
    },
    {
      name:'自提点22',
      position:[117.524441,39.284839],
      zooms:[10,20],
      opacity :1,
      zIndex :4,
      icon,
      text:{
          content:'天津市七里海国家湿地公园',
          direction:'right',
          offset:[-20,-5],
          style:textStyle
      }
    },
    {
      name:'自提点23',
      position:[117.752581,39.102787],
      zooms:[10,20],
      opacity :1,
      zIndex :4,
      icon,
      text:{
          content:'天津市南堤滨海步道公园',
          direction:'right',
          offset:[-20,-5],
          style:textStyle
      }
    },
    {
      name:'自提点24',
      position:[117.676646,39.10392],
      zooms:[10,20],
      opacity :1,
      zIndex :4,
      icon,
      text:{
          content:'天津市塘沽森林公园',
          direction:'right',
          offset:[-20,-5],
          style:textStyle
      }
    },
    {
       name:'自提点25',
       position:[117.362625,40.06397],
       zooms:[10,20],
       opacity :1,
       zIndex :4,
       icon,
       text:{
           content:'春山里',
           direction:'right',
           offset:[-20,-5],
           style:textStyle
       }
     },
     {
       name:'自提点26',
       position:[117.006744,39.617747],
       zooms:[10,20],
       opacity :1,
       zIndex :4,
       icon,
       text:{
           content:'颐正源生态农场',
           direction:'right',
           offset:[-20,-5],
           style:textStyle
       }
     },
    {
        name: '自提点27',
        position: [117.166839, 39.276877],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 4,
        icon,
        text: {
            content: '北辰区仰望村露营地',
            direction: 'right',
            offset: [-20, -5],
            style: textStyle
        }
    },
    {
        name: '自提点28',
        position: [117.347198, 39.010689],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 4,
        icon,
        text: {
            content: '海河教育园区湿地公园',
            direction: 'right',
            offset: [-20, -5],
            style:textStyle
        }
    },
    {
      name:'自提点29',
      position:[117.368971,40.171638],
      zooms:[10,20],
      opacity :1,
      zIndex :4,
      icon,
      text:{
          content:'泥河村',
          direction:'right',
          offset:[-20,-5],
          style:textStyle
      }
    },
    {
      name:'自提点30',
      position:[117.455599,40.254002],
      zooms:[10,20],
      opacity :1,
      zIndex :4,
      icon,
      text:{
          content:'黄崖关长城',
          direction:'right',
          offset:[-20,-5],
          style:textStyle
      }
    },
    {
       name:'自提点31',
       position:[117.87578,39.185374],
       zooms:[10,20],
       opacity :1,
       zIndex :4,
       icon,
       text:{
           content:'AMPM沙滩露营营地',
           direction:'right',
           offset:[-20,-5],
           style:textStyle
       }
     },
     {
       name:'自提点32',
       position:[117.843706,39.098068],
       zooms:[10,20],
       opacity :1,
       zIndex :4,
       icon,
       text:{
           content:'东堤公园',
           direction:'right',
           offset:[-20,-5],
           style:textStyle
       }
     },
     {
         name:'自提点33',
         position:[116.912608,39.051375],
         zooms:[10,20],
         opacity :1,
         zIndex :4,
         icon,
         text:{
             content:'秘境营地',
             direction:'right',
             offset:[-20,-5],
             style:textStyle
         }
     },
     {
         name:'自提点34',
         position:[117.101748,38.986624],
         zooms:[10,20],
         opacity :1,
         zIndex :4,
         icon,
         text:{
             content:'团泊湖新桥',
             direction:'right',
             offset:[-20,-5],
             style:textStyle
         }
     },
     {
         name:'自提点35',
         position:[116.985819,39.62464],
         zooms:[10,20],
         opacity :1,
         zIndex :4,
         icon,
         text:{
             content:'漫森活农场采摘园',
             direction:'right',
             offset:[-20,-5],
             style:textStyle
         }
     },

    {
        name: '自提点36',
        position: [117.006744, 39.617747],
        zooms: [10, 20],
        opacity: 1,
        zIndex: 4,
        icon,
        text: {
            content: '颐正源农场',
            direction: 'right',
            offset: [-20, -5],
            style:textStyle
        }
    },
    {
      name:'自提点37',
      position:[117.489827,39.195754],
      zooms:[10,20],
      opacity :1,
      zIndex :4,
      icon,
      text:{
          content:'万科东丽湖营地',
          direction:'right',
          offset:[-20,-5],
          style:textStyle
      }
    },
    {
      name:'自提点38',
      position:[117.497157,39.1858],
      zooms:[10,20],
      opacity :1,
      zIndex :4,
      icon,
      text:{
          content:'生态体育公园',
          direction:'right',
          offset:[-20,-5],
          style:textStyle
      }
    },
    {
       name:'自提点39',
       position:[117.71741,39.042524],
       zooms:[10,20],
       opacity :1,
       zIndex :4,
       icon,
       text:{
           content:'泰丰公园',
           direction:'right',
           offset:[-20,-5],
           style:textStyle
       }
     },
     {
       name:'自提点40',
       position:[117.106695,39.193942],
       zooms:[10,20],
       opacity :1,
       zIndex :4,
       icon,
       text:{
           content:'墅外桃源·户外野营',
           direction:'right',
           offset:[-20,-5],
           style:textStyle
       }
     },
     {
         name:'自提点41',
         position:[116.93665,39.150336],
         zooms:[10,20],
         opacity :1,
         zIndex :4,
         icon,
         text:{
             content:'柳仙林生态园',
             direction:'right',
             offset:[-20,-5],
             style:textStyle
         }
     },
     {
         name:'自提点42',
         position:[117.264154,38.881527],
         zooms:[10,20],
         opacity :1,
         zIndex :4,
         icon,
         text:{
             content:'稻香农谷',
             direction:'right',
             offset:[-20,-5],
             style:textStyle
         }
     }
]
var tentmarkers = [];
var allowCollision = false;
var tentlayer = new AMap.LabelsLayer({
zooms: [3, 20],
zIndex: 1000,
// collision: false,
// 设置 allowCollision：true，可以让标注避让用户的标注
allowCollision,
});
tentlayer.add(tentmarkers);
// 图层添加到地图
map.add(tentlayer);
//初始化 labelMarker
for (var i = 0; i < tentLabelsData.length; i++) {
    var curData = tentLabelsData[i];
    curData.extData = {
        index: i
    };

    var tentlabelMarker = new AMap.LabelMarker(curData);

    tentmarkers.push(tentlabelMarker);

}
// tentlayer.add(tentmarkers);
// map.add(tentlayer);

